var app = getApp();
Page({
	data: {
		curNav:1,
		curIndex:0,
		navList:[],
		dishesList:[]
	},
  onLoad() {
    var that = this;
    wx.request({
      url: app.globalData.weburl + app.globalData.jiekou + '/get_services',
      header: { 'content-type': 'application/json' },
      success: function (res) {
        var listlength = res.data.list.length;
        for (var i = 0; i < listlength; i++) {
          if (res.data.list[i].length > 0) {
            var list2length = res.data.list[i].length;
            for (var b = 0; b < list2length; b++) {
              res.data.list[i][b]['images'] = app.globalData.weburl + res.data.list[i][b]['images'];
            }
          }
        }
        that.setData({
          dishesList: res.data.list,
          navList: res.data.service
        });
      }
    })
  },

    // 侧边栏切换
    selectNav(event) {
        console.log(event.currentTarget.dataset.id);
        var id = event.currentTarget.dataset.id,
            index = parseInt(event.target.dataset.index);
        this.setData({
            curNav: id,
            curIndex: index
        })
  }, itemclick: function (res) {
    console.log(res.currentTarget.dataset.id);

    wx.navigateTo({
      url: '../service/details/details?id=' + res.currentTarget.dataset.id,
    })
  }
})